package com.bondex.charter.controller;

import com.bondex.charter.maindata.pojo.api.BaseComPackageVO;
import com.bondex.charter.maindata.pojo.api.BaseSeaDeliveryMethodVO;
import com.bondex.charter.maindata.pojo.api.BaseSeaFreightClauseVO;
import com.bondex.charter.maindata.pojo.api.BaseSeaPortVO;
import com.bondex.charter.service.BasicDataService;
import com.bondex.global.pojo.JsonDataT;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 通用参数获取
 * Created by JD on 2021/5/17.
 */
@Controller
@RequestMapping("/Basic")
@Tag(name = "Basic")
public class BasicController extends BaseController {

    @Resource
    private BasicDataService basicDataService;

    /**
     * 港口数据字典查询
     *
     * @param token
     * @param sLikeStr
     * @return
     */
    @Operation(summary = "港口数据字典查询")
    @RequestMapping(value = "/getSeaPortForAutocomplete" , method = RequestMethod.POST)
    @ResponseBody
    public JsonDataT<List<BaseSeaPortVO>> getSeaPortForAutocomplete(@Parameter(description = "token") String token, @Parameter(description = "sLikeStr") String sLikeStr) {
        if (null != token) {
            return basicDataService.getSeaPortForAutocomplete(token, sLikeStr);
        } else {
            return null;
        }
    }

    /**
     * 包装方式数据字典
     * @param token
     * @param sLikeStr
     * @return
     */
    @Operation(summary = "包装方式数据字典")
    @RequestMapping(value = "/getComPackageForAutocomplete" , method = RequestMethod.POST)
    @ResponseBody
    public JsonDataT<List<BaseComPackageVO>> getComPackageForAutocomplete(@Parameter(description = "token") String token, @Parameter(description = "sLikeStr") String sLikeStr) {
        if (null != token) {
            return basicDataService.getComPackageForAutocomplete(token, sLikeStr);
        } else {
            return null;
        }
    }

    /**
     * 运费条款数据字典
     * @param token
     * @param sLikeStr
     * @return
     */
    @Operation(summary = "运费条款数据字典")
    @RequestMapping(value = "/getSeaDeliveryMethodForAutocomplete" , method = RequestMethod.POST)
    @ResponseBody
    public JsonDataT<List<BaseSeaDeliveryMethodVO>> getSeaDeliveryMethodForAutocomplete(@Parameter(description = "token") String token,@Parameter(description = "sLikeStr")String sLikeStr) {
        if (null != token) {
            return basicDataService.getSeaDeliveryMethodForAutocomplete(token, sLikeStr);
        } else {
            return null;
        }
    }

    /**
     * 付款方式数据字典
     * @param token
     * @param sLikeStr
     * @return
     */
    @Operation(summary = "付款方式数据字典")
    @RequestMapping(value = "/getSeaFreightClauseForAutocomplete" , method = RequestMethod.POST)
    @ResponseBody
    public JsonDataT<List<BaseSeaFreightClauseVO>> getSeaFreightClauseForAutocomplete(@Parameter(description = "token")String token, @Parameter(description = "sLikeStr")String sLikeStr) {
        if (null != token) {
            return basicDataService.getSeaFreightClauseForAutocomplete(token, sLikeStr);
        } else {
            return null;
        }
    }
}